package love.lemoncat.service;

import com.alibaba.fastjson.JSONObject;
import love.lemoncat.entity.BaseInfo;
import love.lemoncat.entity.Param;
import love.lemoncat.entity.Tab;
import love.lemoncat.websocket.msg.RequestMsg;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * 模拟数据
 */
@Service
public class MockDevService {
    public String get(RequestMsg requestMsg) {
        Param p1 = new Param("参数一");
        Param p2 = new Param("参数二");
        Param p3 = new Param("参数三");
        Param p4 = new Param("参数四");
        Param p5 = new Param("参数五");
        Param p6 = new Param("参数六");
        Param p7 = new Param("参数七");
        Param p8 = new Param("参数八");
        Param p9 = new Param("参数九");
        Param p10 = new Param("参数十");


        Tab q1 = new Tab("查询接口");
        q1.getParams().addAll(Arrays.asList(p1,p2));
        Tab q2 = new Tab("查询网络接口");
        q2.getParams().addAll(Arrays.asList(p3,p4));

        Tab c1 = new Tab("控制接口");
        c1.getParams().addAll(Arrays.asList(p5,p6,p7));
        Tab c2 = new Tab("控制网络接口");
        c2.getParams().addAll(Arrays.asList(p8,p9,p10));

        BaseInfo baseInfo = new BaseInfo("1");
        baseInfo.getParam().addAll(Arrays.asList(q1,q2));
        baseInfo.getCtrl().addAll(Arrays.asList(c1,c2));

        return JSONObject.toJSONString(baseInfo);
    }
}
